#ifndef __FILEUTIL_H__
#define __FILEUTIL_H__

#include <vector>
#include <string>

#ifdef __WIN32__
#include <windows.h>
#define FS_SEPERATOR '\\'
#else
#include <dirent.h>
#define FS_SEPERATOR '/'
#endif

#include "Ringer.h"
#include "RingerMetaServer.h"
#include "RingerFS.h"

using namespace std;

#ifndef MAX_PATH
#define MAX_PATH   260
#endif

void ListAllSubFiles(const char *, std::vector<std::string>&);
void SetRingeDirCreateMode(mode_t mode);
void SetRingerLCache(std::string& lc);
void SetRingerPathPrefix(ringer::rpath_t pre);
int ReadLocalBlock(ringer::RingerBlock&, const ringer::rpath_t&, const int32_t, const int32_t);
int WriteReturnValueToDisk(const std::string&, const ringer::RingerBlock&, const int);
void LocalizeRingerPath(const char *path, string& local_path);
void RingerizeFusePath(const char *path, string &ringer_path);
bool IsFileInLocalCache(const char* path);
bool IsFileInLocalCacheAndStillCurrent(const char* path, ringer::RNode &);
void RnodeFromPath(const char *path, ringer::RNode &rn);
void StatFromRNode(ringer::RNode &rn, struct stat *stbuf);
void GetDirList(const char* szDir, vector<string> &vFiles, vector<string> &vDirs);
void ExtractFilename(const char* szPath, string &szOutFile);
void ExtractParentDirname(const char *szPath, string& szOutDir);
void ExtractDirname(char* szPath, char* szOutDir);
void ExtractExtension(char* szPath, char* szOutExt);
void ReplaceSlashes(char* szPath);
bool AreFilesSame(char* szFile1, char* szFile2);
bool IsFile(char *);
bool IsDir(char *);

int GetIpAddress(ringer::host_t*);
float HashExtension(char* szPath);

int parse_ringer_args(int, char **, ringer::RingerNetworkArgs*, char **);


#endif // __FILEUTIL_H__
